import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/manage/user',
    method: 'get',
    params: query
  })
}

export function fetchUser() {
  return request({
    url: '/manage/user',
    method: 'get'
  })
}

export function createUser() {
  return request({
    url: '/manage/user/create',
    method: 'get'
  })
}

export function saveUser(data) {
  return request({
    url: '/manage/user',
    method: 'post',
    data
  })
}

export function updateUser(data) {
  return request({
    url: '/manage/user/' + data.id,
    method: 'put',
    data
  })
}

export function modifyUser(id, field, value) {
  return request({
    url: '/manage/user/' + id,
    method: 'patch',
    data: { field, value }
  })
}

export function deleteUser(id, status) {
  return request({
    url: '/manage/user/' + id,
    method: 'delete',
    data: { flag: status }
  })
}
